﻿function IdiomaAluno() {
    this.UsuarioId = 0;
    this.IdiomaId = 0;
    this.Nivel = 0;

    this.Salvar = function (callback) {
        var json = "{idiomaId: " + this.IdiomaId.toString() + ", nivel: '" + this.Nivel + "'}";
        
        $.ajax({
            url: eS.UrlPadrao + 'Views/Cadastros/Curriculo.aspx/AddIdiomaUsuario',
            type: "post",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: json,
            success: function (e) {
                callback(e, true);
            },
            error: function (e) {
                callback(e, false);
            }
        });
    }
    this.Excluir = function (callback) {
        var json = "{idiomaId: " + this.IdiomaId.toString(10) + ", usuarioId: " + this.UsuarioId.toString(10) + "}"
        $.ajax({
            url: eS.UrlPadrao + 'Views/Cadastros/Curriculo.aspx/RemoveIdiomaUsuario',
            type: "post",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: json,
            success: function (e) {
                callback(e, true);
            },
            error: function (e) {
                callback(e, false);
            }
        });
    }
}